package com.qf.hospital.mapper;

import com.qf.hospital.entity.Report;
import com.qf.hospital.entity.ReportExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ReportMapper {
    long countByExample(ReportExample example);

    int deleteByExample(ReportExample example);

    int deleteByPrimaryKey(Integer reportId);

    int insert(Report record);

    int insertSelective(Report record);

    List<Report> selectByExample(ReportExample example);

    Report selectByPrimaryKey(Integer reportId);

    int updateByExampleSelective(@Param("record") Report record, @Param("example") ReportExample example);

    int updateByExample(@Param("record") Report record, @Param("example") ReportExample example);

    int updateByPrimaryKeySelective(Report record);

    int updateByPrimaryKey(Report record);

    /**
     * 查询今日门诊人数
     * @return
     */
    @Select("select count(0) from report where DATE_FORMAT(time,'%Y-%m-%d') = DATE_FORMAT(now(),'%Y-%m-%d') and state != 0")
    long findReportCountByCurrent();

    List<Report> findPatientInformation(@Param("cc") Integer cc, @Param("name") String name);

    @Select("select count(0) from report where ${column} = #{value} and state in (1,2,3)")
    int checkExist(@Param("column") String column,@Param("value") String value);

    List<Report> findPresentionInfo(@Param("name") String name);

    @Select("select zhuan from report where report_id = #{reid}")
    String fingZhuanById(@Param("reid") Integer reid);

    List<Report> findPatientByDrugName(@Param("durgname") String durgname);
}